package com.dragonlance;

import java.nio.charset.CharacterCodingException;

import org.apache.mina.core.session.IoSession;

import com.dragonlance.beans.User;
import com.dragonlance.net.PackageOut;

public class ClientOut {
	private IoSession session;
	public ClientOut(IoSession session) {
		this.session = session;
	}
	
	public void sendLogin(User user) throws CharacterCodingException{
		PackageOut pkg = new PackageOut(1);
		pkg.writeUtf(user.getUserName());
		sendPkg(pkg);
	}

	public void sendPkg(PackageOut pkg) {
		session.write(pkg);
	}
}
